import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(home: SliverWidget()));
}

Widget SliverWidget() {
  return Material(
    child: CustomScrollView(
      slivers: <Widget>[
        // AppBar(title: const Text('App Name'),),
        SliverAppBar(
          pinned: true, //划到顶端会固定
          expandedHeight: 250.0,
          flexibleSpace: FlexibleSpaceBar(
            title: const Text('Demo'),
            background: Image.asset(
              "assets/images/img.png",
              fit: BoxFit.cover,
            ),
          ),
        ),
      SliverToBoxAdapter( //将 RenderBox 适配为 Sliver
        child: SizedBox(
          height: 300,
          child: PageView(
            children: const [Text('1'), Text('2')],
          ),
        ),
      ),
      ],
    ),
  );
}
